package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.model.*;
import org.testis.gui.mvc.controller.testdesign.TestStepController;

/**
 *
 * @author Cahit Emir Erel
 */
public class TestStepModel extends AbstractModel {

    private Boolean m_aSynchCall = false;
    private Boolean m_critical = false;
    private Boolean m_dataArrayAppliesToCase = false;
    private Boolean m_testStepVisibility = false;
    private Byte m_successPercentage = new Byte("100");
    private Integer m_browserSpeed = 0;
    private Integer m_delayTime = 0;
    private Integer m_numberOfRetryOnFail = 1;
    private Integer m_timeout = 120;
    private String m_action = "";
    private String m_browserType = "";
    private String m_description = "";
    private Integer m_device = 0;
    private String m_dutIp = "";
    private String m_moduleType = "";
    private String m_name = "";
    private Integer m_pc = 0;
    private String m_supportedDeviceGroup = "";
    private String m_lastWarning = "";
    private Integer m_afterdelayTime = 0;
    private String m_storeResultPostfix = "";

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        if (name == null) {
            name = "";
        }
        String oldName = m_name;
        m_name = name;
        firePropertyChange(TestStepController.CHANGE_NAME,
                oldName,
                name);
    }

    public String getDescription() {
        return m_description;
    }

    public void setDescription(String description) {
        if (description == null) {
            description = "";
        }
        String oldDescription = m_description;
        m_description = description;
        firePropertyChange(TestStepController.CHANGE_DESCRIPTION,
                oldDescription,
                description);
    }

    public Integer getTimeout() {
        return m_timeout;
    }

    public void setTimeout(Integer timeout) {
        if (timeout == null) {
            return;
        }
        Integer oldTimeout = m_timeout;
        m_timeout = timeout;
        firePropertyChange(TestStepController.CHANGE_TIMEOUT,
                oldTimeout,
                timeout);
    }

    public Integer getBrowserSpeed() {
        return m_browserSpeed;
    }

    public void setBrowserSpeed(Integer browserSpeed) {
        if (browserSpeed == null) {
            return;
        }
        Integer oldBrowserSpeed = m_browserSpeed;
        m_browserSpeed = browserSpeed;
        firePropertyChange(TestStepController.CHANGE_BROWSER_SPEED,
                oldBrowserSpeed,
                browserSpeed);
    }

    public String getBrowserType() {
        return m_browserType;
    }

    public void setBrowserType(String browserType) {
        if (browserType == null) {
            browserType = "";
        }
        String oldBrowserType = m_browserType;
        m_browserType = browserType;
        firePropertyChange(TestStepController.CHANGE_BROWSER_TYPE,
                oldBrowserType,
                browserType);
    }

    public Integer getDevice() {
        return m_device;
    }

    public void setDevice(Integer device) {
        if (device == null) {
            device = 0;
        }
        Integer olddevice = m_device;
        m_device = device;
        firePropertyChange(TestStepController.CHANGE_DEVICE,
                olddevice,
                device);
    }

    public void setTestStepVisibility(Boolean testStepVisibility) {
        if (testStepVisibility == null) {
            return;
        }
        Boolean oldTestStepVisibility = m_testStepVisibility;
        m_testStepVisibility = testStepVisibility;
        firePropertyChange(TestStepController.SHOW_ADD_TEST_STEP,
                oldTestStepVisibility,
                testStepVisibility);
    }

    public Boolean getTestStepVisibility() {
        return m_testStepVisibility;
    }

    public String getSupportedDeviceGroup() {
        return m_supportedDeviceGroup;
    }

    public void setSupportedDeviceGroup(String supportedDeviceGroup) {
        if (supportedDeviceGroup == null) {
            supportedDeviceGroup = "";
        }
        String oldSupportedDeviceGroup = m_supportedDeviceGroup;
        m_supportedDeviceGroup = supportedDeviceGroup;
        firePropertyChange(TestStepController.CHANGE_SUPPORTED_DEVICE_GROUP,
                oldSupportedDeviceGroup,
                supportedDeviceGroup);
    }

    public String getAction() {
        return m_action;
    }

    public void setAction(String action) {
        if (action == null) {
            action = "";
        }
        String oldAction = m_action;
        m_action = action;
        firePropertyChange(TestStepController.CHANGE_ACTION,
                oldAction,
                action);
    }

    public Boolean getDataArrayAppliesToCase() {
        return m_dataArrayAppliesToCase;
    }

    public void setDataArrayAppliesToCase(Boolean dataArrayAppliesToCase) {
        if (dataArrayAppliesToCase == null) {
            return;
        }
        Boolean oldDataArrayAppliesToCase = m_dataArrayAppliesToCase;
        m_dataArrayAppliesToCase = dataArrayAppliesToCase;
        firePropertyChange(TestStepController.CHANGE_DATA_ARRAY_APPLIES_TO_CASE,
                oldDataArrayAppliesToCase,
                dataArrayAppliesToCase);
    }

    public Integer getAfterDelayTime() {
        return m_afterdelayTime;
    }

    public void setAfterDelayTime(Integer afterDelayTime) {
        if (afterDelayTime == null) {
            return;
        }
        Integer oldAfterDelayTime = m_afterdelayTime;
        m_afterdelayTime = afterDelayTime;
        firePropertyChange(TestStepController.CHANGE_AFTER_DELAY_TIME,
                oldAfterDelayTime,
                afterDelayTime);
    }

    public Integer getDelayTime() {
        return m_delayTime;
    }

    public void setDelayTime(Integer delayTime) {
        if (delayTime == null) {
            return;
        }
        Integer oldDelayTime = m_delayTime;
        m_delayTime = delayTime;
        firePropertyChange(TestStepController.CHANGE_DELAY_TIME,
                oldDelayTime,
                delayTime);
    }

    public Boolean getASynchCall() {
        return m_aSynchCall;
    }

    public void setASynchCall(Boolean aSynchCall) {
        if (aSynchCall == null) {
            return;
        }
        Boolean oldASynchCall = m_aSynchCall;
        m_aSynchCall = aSynchCall;
        firePropertyChange(TestStepController.CHANGE_ASYNCH_CALL,
                oldASynchCall,
                aSynchCall);
    }

    public Integer getNumberOfRetryOnFail() {
        return m_numberOfRetryOnFail;
    }

    public void setNumberOfRetryOnFail(Integer numberOfRetryOnFail) {
        if (numberOfRetryOnFail == null) {
            return;
        }
        Integer oldNumberOfRetryOnFail = m_numberOfRetryOnFail;
        m_numberOfRetryOnFail = numberOfRetryOnFail;
        firePropertyChange(TestStepController.CHANGE_NUMBER_OF_RETRY_ON_FAIL,
                oldNumberOfRetryOnFail,
                numberOfRetryOnFail);
    }

    public Boolean getCritical() {
        return m_critical;
    }

    public void setCritical(Boolean critical) {
        if (critical == null) {
            return;
        }
        Boolean oldCritical = m_critical;
        m_critical = critical;
        firePropertyChange(TestStepController.CHANGE_CRITICAL,
                oldCritical,
                critical);
    }

    public Byte getSuccessPercentage() {
        return m_successPercentage;
    }

    public void setSuccessPercentage(Byte successPercentage) {
        if (successPercentage == null) {
            return;
        }
        Byte oldSuccessPercentage = m_successPercentage;
        m_successPercentage = successPercentage;
        firePropertyChange(TestStepController.CHANGE_SUCCESS_PERCENTAGE,
                oldSuccessPercentage,
                successPercentage);
    }

    public String getModuleType() {
        return m_moduleType;
    }

    public void setModuleType(String moduleType) {
        if (moduleType == null) {
            moduleType = "";
        }
        String oldModuleType = m_moduleType;
        m_moduleType = moduleType;
        firePropertyChange(TestStepController.CHANGE_MODULE_TYPE,
                oldModuleType,
                moduleType);
    }

    public Integer getPc() {
        return m_pc;
    }

    public void setPc(Integer pc) {
        if (pc == null) {
            pc = 0;
        }
        Integer oldPc = m_pc;
        m_pc = pc;
        firePropertyChange(TestStepController.CHANGE_PC,
                oldPc,
                pc);
    }

    public String getDutIp() {
        return m_dutIp;
    }

    public void setDutIp(String dutIp) {
        if (dutIp == null) {
            dutIp = "";
        }
        String oldDutIp = m_dutIp;
        m_dutIp = dutIp;
        firePropertyChange(TestStepController.CHANGE_DUT_IP,
                oldDutIp,
                dutIp);
    }

    public String getLastWarning() {
        return m_lastWarning;
    }

    public void setLastWarning(String lastWarning) {
        if (lastWarning == null) {
            lastWarning = "";
        }
        String oldVal = m_lastWarning;
        m_lastWarning = lastWarning;
        firePropertyChange(TestStepController.CHANGE_LAST_WARNING,
                oldVal,
                m_lastWarning);

    }

    /**
     * @return the m_storeResultPostfix
     */
    public String getStoreResultPostfix() {
        return m_storeResultPostfix;
    }

    /**
     * @param m_storeResultPostfix the m_storeResultPostfix to set
     */
    public void setStoreResultPostfix(String storeResultPostfix) {
        if (storeResultPostfix == null) {
            storeResultPostfix = "";
        }
        String oldValue = m_storeResultPostfix;
        m_storeResultPostfix = storeResultPostfix;
        firePropertyChange(TestStepController.CHANGE_STORE_RESULT_POSTFIX,
                oldValue,
                m_storeResultPostfix);
    }
}
